# def login_front():
#     #前台登录
#     username = '1234'
#     password = '123456'
#     print(username,password)
# #
# def login_back():
#     #后台登录
#     username = 'admin'
#     password = '666666'
#     print(username,password)
#
# if __name__ == '__main__':
#     password = '888888'
#     globals password
#     password = '9999'
#     login_front()
#     login_back()
# # # 优先使用局部变量
# 缺省参数
# def person_info(name,gender = True,title = '学员'):
    # '''
    # 人员信息
    # :param name:
    # :param gender:
    # :return:
    # '''
#     # 初始变量性别
#     sex = '男'
#     # 判断是否为真
#     if not gender:
#         sex = '女'
#     print(f'姓名为{name},性别为{sex},职位为{title}')
#
#
# # person_info('张三',title='组长',gender = False)
# # 多值参数
# def demo(num,*args):
#     print(num)
#     print(args)
# demo(1,2,3,4)
# # 数据结果后面的值是一个元组
# # def demo(*args)
# def demo(*args):
#     result = 0
#     for i in args:
#         # 遍历的是函数里面的值,不能输入demo(*args).这是一个定义函数
#         result += i
#     print(result)
# demo(1,2,3,4,5)
# num = [1,2,3,4]
# demo(*num)  解包,因为(1,2,3,4,5)是一个整体,
# *agrs相当于里面有很对位置,让实参去一一对应,*num相当于把一个整体拆分
# 匿名函数:比定义函数简单
# result = lambda a,b:a%b
# print(result(1,2))
# user_list = [ {'name': '张三', 'age': 22, 'title': '测试工程师'}, {'name': '李四', 'age': 24, 'title': '开发工程师'}, {'name': '王五', 'age': 21, 'title': '测试工程师'} ]
# # value = lambda a:a['age']
# # user_list.sort(key=value)
# # print(user_list)
# n = lambda b:b['name']
# print(n)
def mas_info():
    name = input('输入姓名:')
    age = input('输入年龄')
    stu_info = {f'name:{name},age:{age}'}
    return stu_info

list_info = []
for i in range(3):
    data = mas_info()
    list_info.append(data)
print(list_info)

mas_info()

#
# print('-----学生列表信息-----')
# num = 1
# for i in list_info:
#     print(f"{num}   {i.get('name')}    {i.get('age')}")
#     num += 1
# print('---------------------')
# print(mas_info)
#
# def count_info():
#     return len(list_info)
# print(count_info())
#
# def seach_info():
#     find_name = input('请输入要查找的学生姓名')
#     for i in list_info:
#         if find_name == i.get('name'):
#         print(f'姓名:{i.get('name')},年龄:{i.get('age')}')
#         retrun
#     else:
#         print(f'对不起,名字叫{find_name}不存在')